<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="../../css/utils/bootstrap.min.css" />
    <link rel="stylesheet" href="../../css/utils/mui.min.css" />
    <link rel="stylesheet" href="../../css/utils/common.css?version=2" />
    <link rel="stylesheet" href="../../css/utils/toastr.min.css" />
	<title></title>
	<style>
		.content-body {
			margin-top: 50px;
		}
		.content-border {
			width: 40%;
			border: 1px solid #A1A1A1;
			padding: 20px 10px;
		}
		.form-inline {
			margin-top: 20px;
		}
		.form-inline .form-group label {
			margin-right: 10px;
			color: #7B7B7B;
		}
		.form-inline .form-group .search-input {
			width: 250px;	
		}
		.search-input::-webkit-input-placeholder {
			text-align: center;
		}
		.text-prompt {
			margin-top: 20px;
			color: #666666;
		}
		.list-body {
			height: 600px;
		}
		.article-body {
			position: relative;
			width: calc(100% - 50px);
			padding: 10px 0;
		}
		.list-li .media-object {
			width: 80px;
			height: 45px;
			margin-right: 10px;
		}
		.author {
			color: #11B5AB;
			margin-right: 10px;
		}
		.left-absolute {
			position: absolute;
			right: 10px;
			top: 24px;
		}
		.right-absolute {
			position: absolute;
			right: 10px;
			top: 24px;
		}
		.checkbox-false {
			width: 30px;
			height: 30px;
			background: url(../../img/myExtension/checkbox-false.png) no-repeat;
		}
		.checkbox-true {
			width: 30px;
			height: 30px;
			background: url(../../img/myExtension/checkbox-true.png) no-repeat;
		}
		.content-point {
			position: relative;
			width: 12%;
			height: 700px;
		}
		.point-body {
			position: absolute;
			top: 50%;
			width: 100%;
			margin-top: -65px;
			text-align: center;
		}
		.point-right {
			width: 50px;
			height: 50px;
			margin: 0 auto;
			margin-bottom: 100px;
			background: url(../../img/myExtension/point-right.png) no-repeat;
		}
		.point-right.active {
			background: url(../../img/myExtension/point-right-active.png) no-repeat;
		}
		.point-left {
			width: 50px;
			height: 50px;
			margin: 0 auto;
			background: url(../../img/myExtension/point-left.png) no-repeat;
		}
		.point-left.active {
			background: url(../../img/myExtension/point-left-active.png) no-repeat;
		}
		.float-btn {
			margin-top: 16px;
			text-align: center;
		}
		.float-btn button {
			width: 135px;
			margin-left: 10px;
		    background-color: #11B5AB;
		    color: #fff;
		    border-color: #11B5AB;
		}
		.float-btn button:focus, .float-btn button:hover {
			color: #fff;
			background-color: #2aeee2;
		}
		
		.modal-body {
			padding: 15px 40px;
		}
		.author-title {
			margin-top: 10px;
			color: #666;
		}
		.author-title img {
			margin-right: 10px;
		}
		.author-title span {
			vertical-align: middle;
		}
		.article-time {
			margin-left: 30px;
		}
		.table-list {
			margin-bottom: 50px;
		}
		.table-btn {
			margin: 20px 0;
		}
		
		/*预览model*/
		.preview-content {
			display: flex;
		}
		.phone-model {
			width: 260px;
			height: 500px;
			margin: 50px 70px;
			padding: 95px 15px 58px 13px;
			background: url(../../img/myExtension/phone-model.png) no-repeat;
			background-size: 100% 100%;
		}
		.phone-content {
			position: relative;
			width: 100%;
			height: 100%;
			padding: 0 0 10px 10px;
			color: #666666;
		}
		#previewArticle {
			display: none;
			padding-top: 10px;
			padding-bottom: 50px;
		}
		#iframePage {
			display: none;
		}
		.phone-title {
			color: #111;
			/*font-size: 16px;*/
		}
		.phone-body {
			font-size: 12px;
		}
		.phone-body img {
			max-width: 100%;
			height: auto;
		}
		.scan-wechat {
			margin-top: 70px;
		}
		.preview-qrcode {
			width: 386px;
			height: 220px;
			border: 1px solid #A1A1A1;
			text-align: center;
		}
		.preview-qrcode .qrcode {
			width: 150px;
			height: 150px;
			margin: 0 auto;
			margin-top: 25px;
			border: 1px solid #A1A1A1;
		}
		.preview-qrcode .qrcode canvas {
			width: 100%;
			height: 100%;
		}
		.preview-qrcode .prompt {
			margin-top: 10px;
			color: #6B6B6B;
		}
		.wechat-share {
			margin-top: 110px;
			padding: 10px;
			width: 386px;
			height: 132px;
			border: 1px solid #A1A1A1;
		}
		.wechat-title {
			font-size: 16px;
			color: #666666;
		}
		.wechat-content {
			display: flex;
			margin-top: 20px;
		}
		.wechat-describe {
			width: calc(100% - 80px);
			height: 62px;
			color: #8E8E8E;
			display: -webkit-box;
		    overflow: hidden;
		    white-space: normal!important;
		    text-overflow: ellipsis;
		    word-wrap: break-word;
		    -webkit-line-clamp: 3;
		    -webkit-box-orient: vertical;
		}
		.wechat-icon img {
			vertical-align: top;
			margin-left: 10px;
			width: 60px;
			height: 60px;
		}
		/*nar报名卡片*/
		.mui-bar {
			position: absolute;
			font-size: 12px;
		}
		.enroll-tab {
			display: none;
		}
		.mui-bar .mui-btn,.mui-bar button {
			font-size: 12px;
		}
		.title-item {
			display: table-cell;
			-webkit-flex: 1;
			-moz-box-flex: 1;
			-ms-flex: 1;
			flex: 1;
			vertical-align: middle;
			padding-left: 10px;
			color: #333;
		}
		.btn-item {
			width: 85px;
			display: table-cell;
			text-align: center;
		}
		.mui-bar .mui-btn {
			padding: 6px 12px;
		}
		/*nar名片卡片*/
		.card-tab {
			display: none;
		}
		.merge-tab {
			display: none;
		}
		.user-item {
			position: relative;
			display: table-cell;
			vertical-align: middle;
			padding-left: 5px;
			-webkit-flex: 1;
			-moz-box-flex: 1;
			-ms-flex: 1;
			flex: 1;
			height: 50px;
		}
		.head-img {
			position: absolute;
			top: -15px;
			width: 45px;
			height: 45px;
			padding: 1px;
			border-radius: 50%;
			background-color: #fff;
		}
		.head-img img {
			width: 100%;
			height: 100%;
			border-radius: 50%;
		}
		.icon-item {
			display: table-cell;
			width: 30px;
			height: 30px;
			border-left: 1px solid #CBCBCB;
			vertical-align: middle;
 		   	text-align: center;
		}
		.icon-item img {
			width: 15px;
			height: 15px;
		}
		.user-info-bar {
			margin-left: 48px;
			color: #333;
		}
		.user-info-bar .name {
			margin-right: 10px;
		}
		.user-info-bar .position {
			font-size: 12px;
			color: #666666;
		}
		
		.left-content {
			margin-left: 4%;
		}
		@media (max-width: 1420px){
			.left-content {
				margin-left: 0;
			}
			.content-border {
				width: 45%;
			}
			.content-point {
				width: 10%;
			}
		}
		@media (max-width: 1272px){
			.left-content {
				margin-left: 0;
				width: 40%;
			}
			.right-content {
				width: 50%;
			}
		}
	</style>
</head>
<body>
	<div class="content">
		<div class="content-body">
			<div class="content-border pull-left left-content">
				<div class="text-title">员工软文</div>
				<div class="form-inline space-between">
					<div class="form-group">
						<label for="staffSortSelect">排序：</label>
						<select class="form-control" id="staffSortSelect">
						  	<option value="1">更新时间</option>
						 	<option value="2">总阅读数</option>
						  	<option value="3">总转发数</option>
						  	<option value="4">总发布数</option>
						</select>
					</div>
					<div class="form-group">
					    <div class="input-group">
					      	<input type="search" id="staffSearchInput" class="form-control search-input" placeholder="文章标题/作者">
					      	<div id="staffSearchBtn" class="input-group-addon"><img src="../../img/myExtension/search-ash.png" /></div>
					    </div>
					</div>
				</div>	
				<h6 id="totalStaff" class="text-prompt">共0个结果</h6>
				<div class="refresh-scroll list-body">
					<ul id="staffContentList" class="list-ul">
						<!--<li class="list-li">
							<div class="article-body">
								<img class="media-object pull-left" src="../../img/test-back.jpg" /> 
								<div class="media-body">
									<div class="text-title text-ellipsis">文章标题天天</div>
									<div><span class="author">作者</span><span>2018-5-10 10:23:42</span></div>
								</div>
								<div class="floating-layer">
									<div class="float-btn">
										<button class="btn btn-default" type="button">预览</button>
									</div>
								</div>
							</div>
							<div class="left-absolute checkbox-false"></div>
						</li>-->
					</ul>
				</div>
			</div>
			<div class="content-point pull-left">
				<div class="point-body">
					<div class="point-right"></div>
					<div class="point-left"></div>
				</div>
			</div>
			<div class="content-border pull-left right-content">
				<div class="text-title">内容库</div>
				<div class="form-inline space-between">
					<div class="form-group">
						<label for="companySortSelect">排序：</label>
						<select class="form-control" id="companySortSelect">
						  	<option value="1">最新添加</option>
						 	<option value="2">总阅读数</option>
						  	<option value="3">总转发数</option>
						  	<option value="4">总发布数</option>
						</select>
					</div>
					<div class="form-group">
					    <div class="input-group">
					      	<input id="companySearchInput" type="text" class="form-control search-input" placeholder="文章标题/作者">
					      	<div id="companySearchBtn" class="input-group-addon"><img src="../../img/myExtension/search-ash.png" /></div>
					    </div>
					</div>
				</div>	
				<h6 id="totalCompany" class="text-prompt">共0个结果</h6>
				<div class="refresh-scroll list-body">
					<ul id="companyContentList" class="list-ul">
						<!--<li class="list-li">
							<div class="article-body">
								<img class="media-object pull-left" src="../../img/test-back.jpg" /> 
								<div class="media-body">
									<div class="text-title text-ellipsis">文章标题天天</div>
									<div><span class="author">作者</span><span>2018-5-10 10:23:42</span></div>
								</div>
								<div class="floating-layer">
									<div class="float-btn">
										<button class="btn btn-default" type="button">预览</button>
										<button class="btn btn-default article-data" type="button">数据</button>
										<button class="btn btn-default" type="button">编辑</button>
									</div>
								</div>
							</div>
							<div class="right-absolute checkbox-false"></div>
						</li>-->
					</ul>
				</div>
			</div>
		</div>
	</div>	
	<!-- 分任务Modal -->
	<div class="modal fade bs-example-modal-lg" id="articleDataModel" tabindex="-1" role="dialog" aria-labelledby="articleDataModelLabel">
		<div class="modal-dialog modal-lg modal-1234" role="document">
			<div class="modal-content">
				<div class="modal-header">
			    	<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
			    	<h4 class="modal-title" id="articleDataModelLabel">内容库数据</h4>
				</div>
			  	<div class="modal-body">
			    	<div id="articleDataTitle" class="text-title"></div>
			    	<div class="author-title">
			    		<!--<img class="border-radius-30" src="../../img/headimg.jpg" /><span>作者名称</span><span class="article-time">创建于：2018-5-10 17:38:44</span><span class="article-time">入库于：2018-5-10 17:38:54</span>-->
			    	</div>
			    	<div id="articleDataTable" class="table-list">
						<div class="table-btn">
							<button id="exportTable" class="btn btn-default" type="button">导出表格</button>
						</div>
						<table class="table table-bordered table-hover table-striped">
							<thead>
								<tr>
									<th>序号</th>
									<th>引用者</th>
									<th>引用时间</th>
									<th>带来的转发数</th>
									<th>带来的点赞数</th>
									<th>带来的阅读数</th>
									<th>带来的报名数</th>
									<th>带来的咨询数</th>
									<th>带来的购买量</th>
									<th>发布方式<br />(朋友/朋友圈/任务)</th>
									<th>发布时间</th>
								</tr>
							</thead>
							<tbody>
								<!--<tr>
									<td>1</td>
									<td>多浪</td>
									<td>2018-5-10 19:24:59</td>
									<td>21</td>
									<td>133</td>
									<td>131</td>
									<td>213</td>
									<td>233</td>
									<td>0</td>
									<td>2/4/6</td>
									<td>2018-5-10 19:26:24</td>
								</tr>-->
							</tbody>
						</table>
						<nav id="page" class="text-center" aria-label="Page navigation">
							<ul class="pagination">
							</ul>
						</nav>
					</div>
			  	</div>
			</div>
		</div>
	</div>
	<!--预览model-->
	<div class="modal fade bs-example-modal-lg" id="previewModel" tabindex="-1" role="dialog" aria-labelledby="previewLabel">
		<div class="modal-dialog modal-lg" role="document">
			<div class="modal-content">
				<div class="modal-header">
			    	<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
			    	<h4 class="modal-title" id="previewLabel">预览</h4>
				</div>
			  	<div class="modal-body">
			  		<div class="preview-content">
				    	<div class="phone-model">
				    		<div  class="phone-content">
				    			<div id="previewArticle" class="refresh-scroll">
					    			<!--<p class="phone-title">标题</p>
					    			<h6>2018-5-7 <a>张三丰</a></h6>
					    			<div class="phone-body">
	                            	    
					    			</div>-->
				    			</div>
				    			<iframe src="" id="iframePage" frameborder="0" scrolling="yes" marginwidth="0" marginheight="0" style="height: 280px;width: 216px;"></iframe>
				    			<!--报名-->
								<nav class="mui-bar mui-bar-tab enroll-tab">
									<div class="title-item">
										报名信息防静电索拉卡
									</div>
									<div class="btn-item">
										<button type="button" class="mui-btn btn-theme">立即报名</button>
									</div>
								</nav>
								<!--名片插件管理-->
								<nav class="mui-bar mui-bar-tab card-tab">
									<div class="user-item">
										<!--<a class="head-img">
											<img src="../../img/login/logo.png" />	
										</a>
										<div class="user-info-bar">
											<span class="name">张三丰</span><span class="position">销售总监</span><br />
											<a class="phone" href="tel:">1383838438</a>
										</div>-->
									</div>
									<div class="icon-item qrcode-item customer-wechat-click">
										<img src="../../img/phone/wechat-icon.png" />
									</div>
									<a class="icon-item phone-item customer-phone-click" href="#">
										<img src="../../img/phone/phone-icon.png" />
									</a>
								</nav>
								<!--名片和报名-->
								<nav class="mui-bar mui-bar-tab merge-tab">
									<div class="user-item">
										<!--<a class="head-img">
											<img src="../../img/login/logo.png" />	
										</a>
										<div class="user-info-bar">
											<span class="name">用户名字</span><span class="position">销售总监</span><br />
											<a class="phone" href="tel:18685306265">18685306265</a>
										</div>-->
									</div>
									<div class="icon-item qrcode-item customer-wechat-click">
										<img src="../../img/phone/wechat-icon.png" />
									</div>
									<div class="icon-item merge-item">
										<!--<span class="text-11B5AB">报名</span>-->
									</div>
								</nav>
				    		</div>
				    		
				    	</div>
				    	<div class="scan-wechat">
				    		<div class="preview-qrcode">
				    			<div class="qrcode"></div>
				    			<div class="prompt">
				    				微信扫一扫，开始分享
				    			</div>
				    		</div>
				    		<div class="wechat-share">
				    			<!--<div class="wechat-title text-ellipsis"></div>
				    			<div class="wechat-content">
				    				<div class="wechat-describe"></div>
				    				<div class="wechat-icon">
				    					<img src="../../img/HBuilder.png"/>
				    				</div>
				    			</div>-->
				    		</div>
				    	</div>
			    	</div>
			  	</div>
			</div>
		</div>
	</div>
	
	<script type="text/javascript" src="../../js/utils/jquery-1.12.4.min.js" ></script>
	<script type="text/javascript" src="../../js/utils/bootstrap.min.js" ></script>
	<script type="text/javascript" src="../../js/utils/page.js" ></script>
	<script type="text/javascript" src="../../js/utils/jquery.cookie.js" ></script>
	<script type="text/javascript" src="../../js/utils/jquery.qrcode.min.js" ></script>
	<script type="text/javascript" src="../../js/utils/toastr.min.js" ></script>
	<script type="text/javascript" src="../../js/utils/boot.js" ></script>
	<script>
		var param = {};
		var dataParam = {};
		var userID,companyID;
		var isPageInit  = true;
		$(function(){
			userID = $.cookie("userID");
			companyID = $.cookie("companyID");
			toastr.options = {
                "timeOut": 2000,
                "positionClass": "toast-middle-center"
            };
			//员工推文
			param = {
				userID:userID,
				companyID:companyID,
				type:1,
				keyword:"",
				operation:0
			}
			base.postData(base.url.getArticleContentLibrary, param, callbackStaffContentLibrary);
			//企业推文
			param.operation = 1;
			base.postData(base.url.getArticleContentLibrary, param, callbackCompanyContentLibrary);
		});
		function callbackStaffContentLibrary(data) {
			if (data.success) {
				$("#totalStaff").text("共"+data.context.staffList.length+"个结果");
				var html = "";
				for (var i=0; i<data.context.staffList.length; i++) {
					html += pingStaffContentLibrary(data.context.staffList[i]);
				}
				$("#staffContentList").html(html);
			}else{
				toastr.warning("没有员工软文结果");
			}
		}
		function pingStaffContentLibrary(data){
			var html = '<li class="list-li">'+
						'	<div class="article-body">'+
						'		<input type="hidden" name="articleID" value="'+data.articleID+'" />'+
						'		<img class="media-object pull-left" src="'+data.articleImgUrl+'" />'+ 
						'		<div class="media-body">'+
						'			<div class="text-title text-ellipsis">'+data.articleTitle+'</div>'+
						'			<div><span class="author">'+data.articleAuthor+'</span><span>'+data.alterTime+'</span></div>'+
						'		</div>'+
						'		<div class="floating-layer">'+
						'			<div class="float-btn">'+
						'				<button class="btn btn-default preview-model" type="button">预览</button>'+
						'			</div>'+
						'		</div>'+
						'	</div>'+
						'	<div class="left-absolute checkbox-false"></div>'+
						'</li>';
			return html;
		}
		function callbackCompanyContentLibrary(data) {
			if (data.success) {
				$("#totalCompany").text("共"+data.context.companyList.length+"个结果");
				var html = "";
				for (var i=0; i<data.context.companyList.length; i++) {
					html += pingCompanyContentLibrary(data.context.companyList[i]);
				}
				$("#companyContentList").html(html);
			}else{
				toastr.warning("没有内容库软文结果");
			}
		}
		function pingCompanyContentLibrary(data) {
			var html = '<li class="list-li">'+
						'	<div class="article-body">'+
						'		<input type="hidden" name="articleID" value="'+data.articleID+'" />'+
						'		<input type="hidden" name="category" value="'+data.category+'" />'+
						'		<img class="media-object pull-left" src="'+data.articleImgUrl+'" />'+ 
						'		<div class="media-body">'+
						'			<div class="text-title text-ellipsis">'+data.articleTitle+'</div>'+
						'			<div><span class="author">'+data.articleAuthor+'</span><span>'+data.joinTime+'</span></div>'+
						'		</div>'+
						'		<div class="floating-layer">'+
						'			<div class="float-btn">'+
						'				<button class="btn btn-default preview-model" type="button">预览</button>'+
						'				<button class="btn btn-default article-data" type="button">数据</button>'+
						'				<button class="btn btn-default article-edit" type="button">编辑</button>'+
						'			</div>'+
						'		</div>'+
						'	</div>'+
						'	<div class="right-absolute checkbox-false"></div>'+
						'</li>';
			return html;
		}
		//搜索
		$('#staffSearchInput').bind('keyup', function(event) {	
			if (event.keyCode == "13") {
		　　　　//回车执行查询
				$(this).blur();
				param.operation = 0;
				param.keyword = $(this).val();
				base.postData(base.url.getArticleContentLibrary, param, callbackStaffContentLibrary);
		　　	}
		});
		//按钮搜索
		$("#staffSearchBtn").click(function(){
			param.operation = 0;
			param.keyword = $("#staffSearchInput").val();
			base.postData(base.url.getArticleContentLibrary, param, callbackStaffContentLibrary);
		});
		//排序
		$("#staffSortSelect").change(function(){
			param.operation = 0;
			param.type = $(this).val();
			base.postData(base.url.getArticleContentLibrary, param, callbackStaffContentLibrary);
		});
		
		//搜索
		$('#companySearchInput').bind('keyup', function(event) {	
			if (event.keyCode == "13") {
		　　　　//回车执行查询
				$(this).blur();
				param.operation = 1;
				param.keyword = $(this).val();
				base.postData(base.url.getArticleContentLibrary, param, callbackCompanyContentLibrary);
		　　	}
		});
		//按钮搜索
		$("#companySearchBtn").click(function(){
			param.operation = 1;
			param.keyword = $("#staffSearchInput").val();
			base.postData(base.url.getArticleContentLibrary, param, callbackCompanyContentLibrary);
		});
		//排序
		$("#companySortSelect").change(function(){
			param.operation = 1;
			param.type = $(this).val();
			base.postData(base.url.getArticleContentLibrary, param, callbackCompanyContentLibrary);
		});
		//鼠标悬浮
		$(".list-ul").on("mouseover mouseout", ".article-body", function(event){
			if(event.type == "mouseover"){
				//鼠标悬浮
				$(this).find(".floating-layer").css("opacity", "1");
			}else if(event.type == "mouseout"){
				//鼠标离开
				$(this).find(".floating-layer").css("opacity", "0");
			}
		});
		//左边复选框
		$(".list-ul").on("click", ".left-absolute", function() {
			if ($(this).attr("class").indexOf("checkbox-false") != -1) {
				$(this).attr("class", "left-absolute checkbox-true");
				if ($(".point-right").attr("class").indexOf("active") == -1) {
					$(".point-right").attr("class", "point-right active");
				}
			}else{
				$(this).attr("class", "left-absolute checkbox-false");
				var isCheck = false;
				$(".left-absolute").each(function(e){
					if ($(this).attr("class").indexOf("checkbox-true") != -1) {
						isCheck = true;
					}
				})
				if (!isCheck) {
					if ($(".point-right").attr("class").indexOf("active") != -1) {
						$(".point-right").attr("class", "point-right");
					}
				}
			}
		});
		//右边复选框
		$(".list-ul").on("click", ".right-absolute", function() {
			if ($(this).attr("class").indexOf("checkbox-false") != -1) {
				$(this).attr("class", "right-absolute checkbox-true");
				if ($(".point-left").attr("class").indexOf("active") == -1) {
					$(".point-left").attr("class", "point-left active");
				}
			}else{
				$(this).attr("class", "right-absolute checkbox-false");
				var isCheck = false;
				$(".right-absolute").each(function(e){
					if ($(this).attr("class").indexOf("checkbox-true") != -1) {
						isCheck = true;
					}
				})
				if (!isCheck) {
					if ($(".point-left").attr("class").indexOf("active") != -1) {
						$(".point-left").attr("class", "point-left");
					}
				}
			}
		});
		//右箭头
		$(".point-right").on("click", function(){
			if ($(this).attr("class").indexOf("active") != -1) {
				$(".point-right").attr("class", "point-right");
				//移入操作
				var articleID = "";
				$("#staffContentList").find(".checkbox-true").each(function(i){
					if ($("#staffContentList").find(".checkbox-true").length == i + 1){
						articleID += $(this).closest(".list-li").find("input[name='articleID']").val();	
					}else{
						articleID += $(this).closest(".list-li").find("input[name='articleID']").val() + ",";
					}
				});
				base.postData(base.url.operationContentLibrary, {userID:userID,companyID:companyID,articleID:articleID,type:0}, callbackOperationContentLibrary);
			}else {
				toastr.warning("请选中要移入的内容");
			}
		});
		//左箭头
		$(".point-left").on("click", function(){
			if ($(this).attr("class").indexOf("active") != -1) {
				$(".point-left").attr("class", "point-left");
				//移入操作
				var articleID = "";
				$("#companyContentList").find(".checkbox-true").each(function(i){
					if ($("#companyContentList").find(".checkbox-true").length == i + 1){
						articleID += $(this).closest(".list-li").find("input[name='articleID']").val();	
					}else{
						articleID += $(this).closest(".list-li").find("input[name='articleID']").val() + ",";
					}
				});
				base.postData(base.url.operationContentLibrary, {userID:userID,companyID:companyID,articleID:articleID,type:1}, callbackOperationContentLibrary);
			}else {
				toastr.warning("请选中要移出的内容");
			}
		});
		function callbackOperationContentLibrary(data){
			if (data.success) {
				param.operation = 0;
				param.keyword = "";
				param.type = 1;
				base.postData(base.url.getArticleContentLibrary, param, callbackStaffContentLibrary);
				param.operation = 1;
				base.postData(base.url.getArticleContentLibrary, param, callbackCompanyContentLibrary);
			}else{
				toastr.warning(data.msg);
			}
		}
		//显示文章数据MODEL
		$(".list-ul").on("click", ".article-data", function(){
			var articleID = $(this).closest(".list-li").find("input[name='articleID']").val();
			dataParam = {
				userID:userID,
				companyID:companyID,
				articleID:articleID,
				pageNo:1
			};
			isPageInit = true;
			base.postData(base.url.getArticleDataInfo, dataParam, callbackGetArticleDataInfo);
		});
		function callbackGetArticleDataInfo(data){
			$('#articleDataModel').modal('show');
			if (data.success) {
				$("#articleDataTitle").text(data.context.articleTitle);
				$(".author-title").html('<img class="border-radius-30" src="'+data.context.headImageUrl+'" /><span>'+data.context.articleAuthor+'</span><span class="article-time">创建于：'+data.context.createTime+'</span><span class="article-time">入库于：'+data.context.joinTime+'</span>');
				var html = "";
				for (var i=0; i<data.context.dataList.length; i++) {
					html += pingArticleData(data.context.dataList[i], i+1);
				}
				$("#articleDataTable tbody").html(html);
				if (isPageInit){
					isPageInit = false;
					//初始化分页
					var totalPage = Math.ceil(data.context.totalPage/10);
					if (totalPage == 0) {
						totalPage = 1;
					}
					var page = {
						pageIndex:1,//初始页数
						currentPage:1,//当前页
						showPage:5,//显示页数
						totalPage:totalPage,//总页数
						onPageClick: function(page) {
							$("#page").initPage(page);
							dataParam.pageNo = page.currentPage;
							base.postData(base.url.getArticleDataInfo, dataParam, callbackGetArticleDataInfo);
			    			return false;  //默认的翻页事件
					    }
					};
					$("#page").initPage(page);
				}
			}
		}
		function pingArticleData(data,i){
			var html = '<tr>'+
						'	<td>'+i+'</td>'+
						'	<td>'+data.userName+'</td>'+
						'	<td>'+data.joinTime+'</td>'+
						'	<td>'+data.transmitNum+'</td>'+
						'	<td>'+data.likeNum+'</td>'+
						'	<td>'+data.readNum+'</td>'+
						'	<td>'+data.enrollNum+'</td>'+
						'	<td>'+data.consultNum+'</td>'+
						'	<td>'+data.purchaseNum+'</td>'+
						'	<td>'+data.forwords+'</td>'+
						'	<td>'+data.publishDate+'</td>'+
						'</tr>';
			return html;
		}
		//导向文章数据表格
		$("#exportTable").click(function(){
			if ($("#articleDataTable tbody").find("tr").length == 0) {
				return;
			}
			window.location.href=base.url.exportArticleDataInfo+"?userID="+userID+"&companyID="+companyID+"&articleID="+dataParam.articleID;
		});
		//显示预览model
		$(".list-ul").on("click", ".preview-model", function(){
			var articleID = $(this).closest(".list-li").find("input[name='articleID']").val();
			base.postData(base.url.getArticleInfo, {userID:userID,companyID:companyID,articleID:articleID}, callbackGetArticleInfo);
		});
		//推文详情返回
		function callbackGetArticleInfo(data) {
			if (data.success) {
				if (data.context.category == 1) {
					$("#previewArticle").hide();
					$("#iframePage").attr("src", data.context.contentsLink).show();
				}else{
					var preview = '<p class="phone-title">'+data.context.articleTitle+'</p>'+
				    			  '<h6>'+base.getNowFormatToday()+'&nbsp;<a>'+$.cookie("userName")+'</a></h6>'+
				    			  '<div class="phone-body">'+data.context.articleContent+'</div>';
					$("#previewArticle").html(preview);	
					$("#iframePage").hide();
					$("#previewArticle").show();
				}
				
				$('.preview-qrcode .qrcode').html("");
				$('.preview-qrcode .qrcode').qrcode(data.context.QRCodeUrl);
				var wechat = '<div class="wechat-title text-ellipsis">'+data.context.articleTitle+'</div>'+
		    				'<div class="wechat-content">'+
			    			'	<div class="wechat-describe">'+data.context.articleAbstracts+'</div>'+
			    			'	<div class="wechat-icon">'+
			    			'		<img src="'+data.context.articleImage+'"/>'+
			    			'	</div>'+
			    			'</div>';
				$(".wechat-share").html(wechat);
				//插件管理
				var plugLength = data.context.pluginList.length;
				if (plugLength == 0) {//没有插件
					$("#previewArticle").css("padding-bottom","0");
					$("#iframePage").css("height","347px");
					$(".mui-bar").hide();
				}else if (plugLength == 1) {//一种插件
					$("#previewArticle").css("padding-bottom","50px");
					$("#iframePage").css("height","280px");
					//判断那种插件
					if (data.context.pluginList[0].pluginType == 0){//名片
						var card = data.context.pluginList[0].card;
						var html = '<a class="head-img customer-phone-click" href="tel:'+card.cardUserPhone+'">'+
									'	<img src="'+card.cardHeadImgUrl+'" />'+	
									'</a>'+
									'<div class="user-info-bar">'+
									'	<input type="hidden" name="cardID" value="'+card.id+'" />'+
									'	<span class="name">'+card.cardUserName+'</span><span class="position">'+card.post+'</span><br />'+
									'	<a class="phone customer-phone-click" href="tel:'+card.cardUserPhone+'">'+card.cardUserPhone+'</a>'+
									'</div>';
						$(".card-tab .user-item").html(html);
						$(".card-tab .phone-item").attr("href","tel:"+card.cardUserPhone);
						$(".user-qrcode-img").html('<img src="'+card.wxQcImgUrl+'" />');
						$(".card-tab").css("display","table");
					}else if (data.context.pluginList[0].pluginType == 1) {//报名
						$(".content").css("margin-bottom","50px");
						pluginID = data.context.pluginList[0].pluginID;
						$(".enroll-tab .title-item").text(data.context.pluginList[0].enroll.activityTitle);
						$(".enroll-tab .btn-item button").text(data.context.pluginList[0].enroll.enrollButton);
						$(".enroll-tab").css("display","table");
					}
				}else if (plugLength == 2) {//两种插件
					$("#previewArticle").css("padding-bottom","50px");
					$("#iframePage").css("height","280px");
					for (var i=0; i<data.context.pluginList.length; i++) {
						if (data.context.pluginList[i].pluginType==0) {
							var card = data.context.pluginList[i].card;
							var html = '<a class="head-img customer-phone-click" href="tel:'+card.cardUserPhone+'">'+
										'	<img src="'+card.cardHeadImgUrl+'" />'+	
										'</a>'+
										'<div class="user-info-bar">'+
										'	<input type="hidden" name="cardID" value="'+card.id+'" />'+
										'	<span class="name">'+card.cardUserName+'</span><span class="position">'+card.post+'</span><br />'+
										'	<a class="phone customer-phone-click" href="tel:'+card.cardUserPhone+'">'+card.cardUserPhone+'</a>'+
										'</div>';
							$(".merge-tab .user-item").html(html);
							$(".user-qrcode-img").html('<img src="'+card.wxQcImgUrl+'" />');
						}else if (data.context.pluginList[i].pluginType==1) {
							pluginID = data.context.pluginList[i].pluginID;
							$(".merge-tab .merge-item").html('<span class="font-theme">报名</span>');
						}
					}
					$(".merge-tab").css("display","table");
				}
				$("#previewModel").modal('show');
			}else{
				toastr.warning(data.msg);
			}
		}
		//文章编辑
		$(".list-ul").on("click", ".article-edit", function(){
			$(".top-tab li", parent.document).removeClass("active");
			$(".top-tab li", parent.document).each(function(){
				if ($(this).find("a").attr("data-href") == "myExtension/createContent.html") {
					$(this).addClass("active");
					var path = $(this).find("a").attr("data-href");
					$.cookie("menuUrl", path, {path:"/"});
					history.pushState(null, null, "index.html");
				}
			});
			var articleID = $(this).closest(".list-li").find("input[name='articleID']").val();
			var category = $(this).closest(".list-li").find("input[name='category']").val();
			if (category == 1) {
				window.parent.location = "../index.html?path=myExtension/createUrlContent.html?articleID="+articleID;
			}else{
				window.parent.location = "../index.html?path=myExtension/createContent.html?articleID="+articleID;	
			}
		});
		
	</script>
</body>
</html>
